package com.sft360.kb.drawview;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;

public class RCircleView extends View {

    private String text = "绘制半圆弧";

    public RCircleView(Context context) {
        super(context);
    }

    public RCircleView(Context context,AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Paint paint = new Paint();
        paint.setColor(Color.WHITE);
        paint.setStyle(Paint.Style.FILL);
        paint.setTextSize(20);

        Paint paint1 = new Paint();
        paint1.setColor(Color.BLACK);
        paint1.setStyle(Paint.Style.FILL);

        Paint paint2 = new Paint();
        paint2.setStyle(Paint.Style.STROKE);
//        float left, float top, float right, float bottom
        RectF rectF = new RectF(100,100,900,900);

        canvas.drawArc(rectF,-90,240,false,paint2);

        canvas.drawCircle(500,500,200,paint1);

        canvas.drawText(text,500-(text.length()/2),500,paint);



    }
}
